//
//  MeHomeViewController.m
//  庐山通
//
//  Created by zcj on 15-11-2.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "MeHomeViewController.h"
#import "ItemGroup.h"
#import "Item.h"
#import "ArrayItem.h"
#import "SwitchItem.h"
#import "Grouble.h"
#import "CollectionViewController.h"
#import "WeViewController.h"
#import "SlideTopViewTwo.h"

@interface MeHomeViewController ()
@property (nonatomic,strong)NSMutableArray * advImageUrlArray;
@property (nonatomic,strong)NSArray * leftImg;

@end

@implementation MeHomeViewController
- (NSArray *)leftImg
{
    if (_leftImg == nil) {
        NSString * plistPath = [[NSBundle mainBundle]pathForResource:@"me.plist" ofType:nil];
        _leftImg = [[NSArray alloc]initWithContentsOfFile:plistPath];
    }
    return _leftImg;
}
- (NSMutableArray *)advImageUrlArray
{
    if (_advImageUrlArray == nil) {
        _advImageUrlArray = [[NSMutableArray alloc]init];
    }
    return _advImageUrlArray;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //self.leftImg
    //ZCJLog(@"%@",[self.leftImg[0] objectForKey:@"img"]);
    
    [self addGroups0];
    if (self.advImageUrlArray.count == 0) {
        [self.advImageUrlArray addObject:@"http://img60.ddimg.cn/digital/product/19/1/1960071901_ii_cover.jpg?version=null"];
        [self.advImageUrlArray addObject:@"http://img60.ddimg.cn/digital/product/19/1/1960071901_ii_cover.jpg?version=null"];
    }
    CGFloat myTopViewH = 250;
    CGFloat GoodViewW = self.view.width;
    SlideTopViewTwo * slideTwo = [[SlideTopViewTwo alloc]initWithFrame:CGRectMake(0, 0, GoodViewW, myTopViewH)];
    for (int i = 0; i < self.advImageUrlArray.count; i ++) {
        slideTwo.urlStr = self.advImageUrlArray[i];
    }
    UIView * myHeader = [[UIView alloc]init];
    
    myHeader.size = CGSizeMake(ScreenWidth, 250);
    [myHeader addSubview:slideTwo];
    myHeader.backgroundColor = [UIColor redColor];
    self.tableView.tableHeaderView = myHeader;

}
- (void)addGroups0
{
    // 把一组放到array里面
    ItemGroup  * itemGroup0 = [self addGroup];
    ArrayItem * item0 = [ArrayItem itemWithIcon:@"collection" title:@"我的收藏" destVcClass:[CollectionViewController class]];
    
    ArrayItem * item01 = [ArrayItem itemWithIcon:@"huancun" title:@"清除缓存" destVcClass:nil];
    ArrayItem * me = [ArrayItem itemWithIcon:@"me" title:@"关于我们" destVcClass:[WeViewController class]];
    ArrayItem * yingyong = [ArrayItem itemWithIcon:@"fenxiang" title:@"分享应用" destVcClass:nil];
    itemGroup0.items = @[item0,item01,me,yingyong];
    
}




- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
